<!--银行卡管理-->
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="100px" class="tabel-form" @submit.native.prevent>
      <div>
        <el-form-item label="用户UID">
          <el-input v-model="queryParams.userRandomId" placeholder="请输入用户UID" clearable
                    min-width="250" @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        </el-form-item>
      </div>
    </el-form>
    <el-table v-loading="loading" :data="dataList">
      <el-table-column label="用户UID" align="center" prop="userRandomId" width="180" :show-overflow-tooltip="true"/>
      <el-table-column label="会员等级" align="center" prop="userLevel" width="180" :show-overflow-tooltip="true"/>
      <el-table-column label="注册时间" align="center" prop="lastLoginTime" width="180" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          {{$yun.convertTimestamp(scope.row.lastLoginTime)}}
        </template>
      </el-table-column>
      <el-table-column label="注册IP" align="center" prop="registeriIp" width="180" :show-overflow-tooltip="true"/>
      <el-table-column label="登入IP" align="center" prop="ip" width="180" :show-overflow-tooltip="true"/>
      <el-table-column label="用户余额" align="center" prop="amount" width="180" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          <span>{{ $yun.formatAmount(scope.row.amount) }}</span>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
                @pagination="getList"
    />
  </div>
</template>

<script>
import {activeUserPage} from "@/api/user/active";
import Template from "@/views/setting/template/index.vue";

export default {
  components: {Template},
  data() {
    return {
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      // 用户完成线下理财信息表格数据
      dataList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        id:null,
      },
      open: false,
      title: '',
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        // userName: { required: true, message: '用户名不能为空', trigger: 'blur' },
      },
    }
  },
  created() {
    this.getList()
  },
  methods: {
    /** 查询用户完成线下理财信息列表 */
    getList() {
      this.loading = true
      activeUserPage(this.queryParams).then(response => {
        this.dataList = response.data.records
        this.total = response.data.total
        this.loading = false
      })
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams.id = null
      // this.$refs['queryForm'].clearValidate()
      this.handleQuery()
    },
    /** 新增 */
    handleAdd(row) {
      this.reset()
      this.open = true
      this.title = '添加数据'
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {}
      this.resetForm('form')
    },
  }
}
</script>
